package com.mxx.common.conv;

import org.springframework.core.convert.converter.Converter;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

/**
 * @Auther: Mr. Zeng
 * @Date: 2020/4/29 09:53
 * @Description: 暂无描述
 */
public class LocalDateConverter implements Converter<String, LocalDate> {
    @Override
    public LocalDate convert(String source) {
        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate date = null;
        try {
            date = LocalDate.parse(source, df);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return date;
    }
}
